/*
 *  $Id: NightRitual.cs 1051 2010-05-18 22:10:41Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Cards001.Earth.Spells {
    public class NightRitual: SpellCard {
        public NightRitual(): base("001_e_s_night_ritual") {
            Level = CompleteLevel.ReadyForTest;
            Element = ElementType.Earth;
            Value = 100;
            AddManaCost(ElementType.Earth, 2);
            AddCondition(new DelegateCondition(GetConditionPhrase(), NightRitualCondition));
        }

        private static bool NightRitualCondition(AbstractObject caster, Card card) {
            int count = 0;
            foreach (Creature cr in caster.Owner.GetCreatures())
                if (cr.Disabled) count++; else return false;
            return count >= 3;
        }

        public override void DoAction(TargetArgs args) {
            foreach (Creature cr in args.Player.GetCreatures()) {
                cr.HealBy(NewDamage(args, DamageType.Health, cr.HealthToMax));
                cr.State = CreatureState.Untapped;
            }
        }
    }
}
